﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;

namespace FYPHP
{
    public partial class VirtualShop1 : System.Web.UI.Page
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["fyphp"].ConnectionString);
        
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlCommand cmdSearch;
            SqlDataReader dtrSearch;
            conn.Open();

            cmdSearch = new SqlCommand("Select layout From Virtual_Shop Where v_id=@id", conn);
            cmdSearch.Parameters.AddWithValue("@id", Request.QueryString["id"]);
            dtrSearch = cmdSearch.ExecuteReader();

            dtrSearch.Read();

            String s = dtrSearch["layout"].ToString();
            
            dtrSearch.Close();

            var control = Page.LoadControl("~/layout"+s+".ascx");
            PlaceHolder1.Controls.Add(control);

            conn.Close();
        }
    }
}